import Vue from 'vue'
import Router from 'vue-router'
import axios from 'axios'
// 个人页面
import Edittext from '../views/Editor'
import PerFun from '../components/wj/PerFun.vue' // 个人信息子路由
import myindex from '../views/myindex'
import login from '../views/Login.vue'
import index from '../views/index.vue'
import Tools from "../views/Tool.vue"
import Content from '../views/ArticleContent.vue'
import Guidang from '../views/guidang.vue'
import SendMail from '../components/wj/SendMyMail.vue'
import InBox from '../components/wj/InBox.vue'
import ArticMange from '../components/wj/ArticleMange.vue'
// 安装路由
Vue.use(Router)
// 导出路由
let router = new Router({
  mode: "history", //去掉路由中的#号
  routes: [
    // 路由重新向
    {
      path: "/",
      redirect: "/index"
    },
    /*
     * 个人主页配置路由页面
     * */
    {
      path: "/myindex",
      name: 'myindex',
      component: myindex,
      children: [{
        path: 'perfun/:id', //以“/”开头的嵌套路径会被当作根路径，所以子路由上不用加“/”;在生成路由时，主路由上的path会被自动添加到子路由之前，所以子路由上的path不用在重新声明主路由上的path了。
        name: 'PerFun',
        component: PerFun,
      }, {
        //发件箱
        path: 'sendmail', //以“/”开头的嵌套路径会被当作根路径，所以子路由上不用加“/”;在生成路由时，主路由上的path会被自动添加到子路由之前，所以子路由上的path不用在重新声明主路由上的path了。
        name: 'SendMail',
        component: SendMail,
      }, {
        //收件箱
        path: "inbox",
        name: "InBox",
        component: InBox
      },{
        //文章管理
        path: "articmange/:id",
        name: "ArticMange",
        component: ArticMange
      }
      ]
    }, {
      path: "/login",
      name: "login",
      component: login
    },
    {
      path: "/index",
      name: "index",
      component: index
    },
    //文字编辑页面
    {
      path: "/edit/:articleid",
      name: "edit",
      component: Edittext
    },
    // 工具
    {
      path: "/tools",
      name: "tools",
      component: Tools
    },
    // 文章详情页
    {
      path: "/content/:articleid",
      name: "content",
      component: Content
    },
    // 归档
    {
      path: "/guidang",
      name: "guidang",
      component: Guidang
    }
  ]
});


export default router
